var title = '击败了99%的同龄小朋友！我家宝宝真棒！快来测一测你的宝宝有多棒！'; //标题
var img = 'http://geniusbear.renyk.com/images/logo_bear3.png'; //图片
var content = '天才熊逻辑思维pk大赛，比一比才知道宝宝有多聪明！'; //简介
var link = 'http://geniusbear.renyk.com'; //链接

$.ajax({
	url: './jssdk.php',
	data: {
		appId: 'wxa3a4aa78f1ec058c',
		appSecret: '7bee0251114dbbec83b0deb79f80b3b9'
	},
	dataType: 'json',
	type: 'POST',
	success: function (res) {
		wx.config({
	        debug: false,
	        appId: res.appId,
	        timestamp: res.timestamp,
	    	nonceStr: res.nonceStr,
	        signature: res.signature,
	        jsApiList: [
		        'checkJsApi',
		        'onMenuShareTimeline',
		        'onMenuShareAppMessage',
		        'onMenuShareQQ',
		        'onMenuShareWeibo',
		        'hideMenuItems',
		        'showMenuItems'
		    ]
	    });
	},
	error: function (e) {

	}
});

wx.ready(function () {
	//alert('注册成功');
	wx.onMenuShareAppMessage({
	    title: title,
	    desc: content,
	    link: link,
	    imgUrl: img,
	    //type: '', // 分享类型,music、video或link，不填默认为link
	    //dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
	    success: function () {
	        //alert('分享');
	    },
	    cancel: function () {
	        //alert('取消');
	    }
	});

	wx.onMenuShareTimeline({
	    title: title,
	    link: link,
	    imgUrl: img,
	    success: function () {
	        //alert('分享');
	    },
	    cancel: function () {
	        //alert('取消');
	    }
	});
	wx.onMenuShareQQ({
	    title: title,
	    desc: content,
	    link: link,
	    imgUrl: img,

	    // 用户确认分享后执行的回调函数
	    success: function () {
	        // 用户确认分享后执行的回调函数
	    },

	    cancel:function() {
	        // 用户取消分享后执行的回调函数
	    }
	});

	wx.onMenuShareWeibo({
	    title: title,
	    desc: content,
	    link: link,
	    imgUrl: img,

	    success: function () {
	        // 用户确认分享后执行的回调函数
	    },
	    cancel: function () {
	        // 用户取消分享后执行的回调函数
	    }
	});
});